home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bathints.zip / BH_07.DOC < prev    next >
Text File  |  1988-10-16  |  12KB  |  205 lines

  1.  
  2.                                   BAT-HINT # 7
  3.  
  4. **************************************************************************
  5.  
  6.     from the BATHINTS library... part of the BATPOWER CONFERENCE from:
  7.  
  8.                       THE PAINFRAME OPUS/FIDO 261/1004
  9.                                         
  10.                       Baltimore, Maryland (301) 488-7461
  11.  
  12. **************************************************************************
  13.  
  14.                             ANSI.SYS ESCAPE SEQUENCES
  15.  
  16. ANSI.SYS is a console/video driver that provides a measure of user control
  17. greater than that of DOS.  To harness this control, you must first load the
  18. driver as a configuration command in CONFIG.SYS, then reboot your system. 
  19. Include the following line in your CONFIG.SYS file:
  20.  
  21.    device=ansi.sys
  22.  
  23. If the ANSI.SYS file is not in the directory from which you boot, be sure to
  24. include a path (and a drive specifier if necessary).  For example, if
  25. ANSI.SYS resides in your DOS subdirectory on your hard drive C, then change
  26. the CONFIG.SYS statement to read:
  27.  
  28.    device=c:\dos\ansi.sys
  29.  
  30. All ANSI.SYS commands begin with the escape character (ASCII code 27)
  31. followed by a left square bracket ([).  Three methods for entering the
  32. escape character will be detailed here: 1) from the command line using the
  33. prompt command, 2) using the DOS line editor EDLIN and 3) via popular word
  34. processors.
  35.  
  36. The escape character may be entered from the command line (or in a batch
  37. file) using the PROMPT command.  The PROMPT code for escape is $e as shown
  38. in the following example:
  39.  
  40.    prompt $e                ====  ESC
  41.  
  42. To enter an ANSI.SYS command however, the statement above must also include
  43. the left square bracket thus:
  44.  
  45.    prompt $e[               ====  ESC[
  46.  
  47. The prompt command itself is used to enter the escape character since DOS
  48. does not provide a direct method whereby the escape character may be entered
  49. other than through the PROMPT command.  The PROMPT method may be used at the
  50. command line directly or in a batch file.
  51.  
  52. The escape character may also be entered using EDLIN.  This method is
  53. confusing to many since the text that is initially entered using EDLIN
  54. appears different than the same text viewed later using EDLIN.
  55. After calling up EDLIN and once in insert mode, perform the following
  56. keystrokes to enter the escape character:
  57.  
  58.    hold down the control (ctrl) key and press V then [
  59.  
  60. You must hold the ctrl key down while pressing first V then [.  This
  61. keystroke sequence will hereinafter be noted as CTRL-V[ or ESC.  Note that
  62. the left bracket in the CTRL-V[ sequence IS NOT the left square bracket
  63. needed to complete the beginning of the ANSI.SYS command.  To enter an
  64. ANSI.SYS command you need yet another left square bracket.  Thus you would:
  65.  
  66.    hold down the CTRL key and press V then [ then release the CTRL key      
  67.    and press [
  68.  
  69. to enter the beginning of an ANSI.SYS command.  To further complicate
  70. matters, Edlin will echo the escape character as  ^V[  and will echo the
  71. completed ANSI.SYS leader as  ^V[[  but when the page or list command is
  72. used, EDLIN will echo the completed ANSI.SYS leader as  [^[  in version 3.x
  73. of DOS.
  74.  
  75. Many popular word processing programs also allow the user to enter the
  76. escape character using the ALT key and numeric keypad (for example,
  77. WordPerfect and Microsoft Word).  Use ASCII code 27 for entering the escape
  78. character.  For example, with WordPerfect:
  79.  
  80.    hold down the ALT key and press 2 then 7 on the numeric keypad
  81.    (do not use the number keys situated above your alphabet keys)
  82.  
  83. When you lift your finger off the ALT key after pressing 27, a left arrow
  84. will appear... this is the escape character.  When using your word processor
  85. for such entries, be sure to save your file as an ASCII text file (for
  86. example, use the CTRL-F5 Text In/Out key in WordPerfect).  Again, the text
  87. you entered will appear differently after you save the file and retrieve it
  88. with your word processor.
  89.  
  90. The ANSI.SYS Commands
  91. ---------------------
  92.  
  93. ANSI.SYS commands are of the general form:
  94.  
  95.                       ESC[#
  96.  
  97. followed by a letter.  The number symbol (#) shown above is meant to
  98. represent a digit or series of digits and semicolons appropriate for that
  99. command.  The commands are shown below in tabular form:
  100.  
  101. ----------------------------------------------------------------------------
  102. COMMAND         FUNCTION          DETAILS
  103. ----------------------------------------------------------------------------
  104. ESC[#A          moves cursor up   the column is not changed; # ranges from
  105.                 by # of rows      1-24; if # is omitted, the cursor will be
  106.                                   moved up one row
  107. ----------------------------------------------------------------------------
  108. ESC[#B          moves cursor      the column is not changed; # ranges from
  109.                 down by # of      1-24; if # is omitted, the cursor will be
  110.                 rows              moved down one row
  111. ----------------------------------------------------------------------------
  112. ESC[#C          moves cursor      the row is not changed; # ranges from
  113.                 right by # of     1-79; if # is omitted, the cursor will be
  114.                 columns           moved right one column
  115. ----------------------------------------------------------------------------
  116. ESC[#D          moves cursor      the row is not changed; # ranges from
  117.                 left by # of      1-79; if # is omitted, the cursor will be
  118.                 columns           moved left one column
  119. ----------------------------------------------------------------------------
  120. ESC[#;#H        moves cursor      the first # specifies the row and ranges
  121.   or            to row # and      from 1-20; the second # specifies the
  122. ESC[#;#f        column # (row     column and ranges from 1-79; if row # is
  123.                 is the first #    omitted, the cursor is moved to row 1; if
  124.                 and column is     column # is omitted, the cursor is moved
  125.                 the second #)     to column 1; if both row # and column #
  126.                                   are omitted, the cursor is moved to row 1
  127.                                   and column 1 (the home position); enter
  128.                                   the semicolon when row # is omitted
  129. ----------------------------------------------------------------------------
  130. ESC[s           saves cursor      stores current cursor position; stored
  131.                 position          position can be implemented with restore
  132. ----------------------------------------------------------------------------
  133. ESC[u           restores cursor   restores cursor to position saved with
  134.                 position          save command
  135. ----------------------------------------------------------------------------
  136. ESC[2J          erases display    erases screen; similar to CLS DOS command
  137. ----------------------------------------------------------------------------
  138. ESC[K           erases to end     erases display from cursor position to the
  139.                 of line           end of that line
  140. ----------------------------------------------------------------------------
  141. ESC[=#h         sets display      sets display to monochrome or color and
  142.                 mode              sets graphics resolution; # ranges from
  143.                                   0-7; # codes are shown below:
  144.                                   
  145.                                   0   25 rows x 40 cols, monochrome
  146.                                   1   25 rows x 40 cols, color
  147.                                   2   25 rows x 80 cols, monchrome
  148.                                   3   25 rows x 80 cols, color
  149.                                   4   200 x 320 graphics, color
  150.                                   5   200 x 320 graphics, monochrome
  151.                                   6   200 x 640 graphics, monochrome
  152.                                   7   turn on line wrap, lines longer than
  153.                                       80 characters wrapped to next line
  154. ----------------------------------------------------------------------------
  155. ESC[=7l         t